package com.dlxj.action;

import java.util.List;

import com.dlxj.entity.Model;
import com.dlxj.service.PurviewService;
import com.dlxj.util.MyJSON;

public class PurviewAction {
	String json;
	int id;
	String mid;
	PurviewService purviewService;

	public String findList() {
		List<Model> models = purviewService.findModels();
		json = MyJSON.toJson(models).toString();
		return "success";

	}

	public String findListByPId() {
		List<Model> models = purviewService.findModelByPid(id, true);
		json = MyJSON.toJson(models).toString();
		return "success";

	}

	public String updatePurview() {
		int code = purviewService.updatePurview(id, mid);
		json = "{code:" + code + "}";
		return "success";

	}

	public String getJson() {
		return json;
	}

	public void setJson(String json) {
		this.json = json;
	}

	public PurviewService getPurviewService() {
		return purviewService;
	}

	public void setPurviewService(PurviewService purviewService) {
		this.purviewService = purviewService;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getMid() {
		return mid;
	}

	public void setMid(String mid) {
		this.mid = mid;
	}

}
